package com.aifund.app.controller;

import com.aifund.app.enums.MqExchangeEnum;
import com.aifund.app.enums.MqRoutingKeyEnum;
import com.aifund.common.result.ResultBody;
import com.alibaba.fastjson.JSON;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @Autowired
    RabbitTemplate rabbitTemplate;


    @GetMapping("/pushMsg")
    public Object pushMsg() {
        String str = "dd";
        rabbitTemplate.convertAndSend(MqExchangeEnum.NewApiDirectExchange.getExchangeName(), MqRoutingKeyEnum.NewApiRegister.getRoutingKey(), JSON.toJSONString(str));
        return ResultBody.success();
    }
}
